<!--
试题管理列表
 add by yyp 2019-06-04
-->
<template lang="pug">
  keep-alive
    kalix-table(bizKey="TestQuestion" title='试题管理列表' ref="kalixTable"
    v-bind:tableFields="tableFields"
    v-bind:targetURL="TestQuestionURL"
    v-bind:bizDialog="TestQuestionDialog"
    v-bind:btnList="testQuestionBtnList"
    v-bind:toolbarBtnList="toolbarBtnList"
    bizSearch="testquestionSearch")
      template(slot="tableColumnSlot")
        el-table-column(prop="userName" label="创建人" align="center")
        el-table-column(prop="bankCategoryType" label="题库类别" align="center")
        el-table-column(prop="subjectType" label="试题题目类型" align="center")
        el-table-column(prop="difficulty" label="试题难度" align="center")
        el-table-column(prop="exerciseProblem" label="题目" align="center")
        el-table-column(prop="imgUrl" label="试题图片" align="center")
          template(slot-scope="scope")
            div(v-for="img in getArray(scope.row.imgUrl)")
              img(v-bind:src="img" width="60" height="60" alt="" style="float:left; margin-right: 8px")
</template>

<script type="text/ecmascript-6">
  import {TestQuestionURL} from '../../config.toml'
  import {testquestionConfigBtnList} from './config'
  import KalixTable from '../../../../../components/corelib/components/common/baseTable'

  export default {
    name: 'kalix-mooc-testquestion',
    components: {KalixTable},
    data() {
      return {
        TestQuestionURL: TestQuestionURL,
        tableFields: [
          {prop: 'name', label: '题库类型'}
        ],
        TestQuestionDialog: [
          {id: 'add', dialog: 'testquestionAdd'},
          {id: 'edit', dialog: 'testquestionEdit'},
          {id: 'view', dialog: 'testquestionView'}
        ],
        testQuestionBtnList: testquestionConfigBtnList,
        toolbarBtnList: [
          {id: 'add', isShow: true, title: '添加', icon: 'icon-pinleizengjia', isPermission: true}
        ]
      }
    },
    methods: {
      dataFormat(val) {
        let d = new Date(val)
        return this.$M_FormatDate(d, 'yyyy-MM-dd')
      },
      getArray(val) {
        return val.split(',')
      }
    }
  }
</script>

<style scoped lang="stylus">

</style>
